import { ref } from 'vue'
import { defineStore } from 'pinia'
import req from '@/utils/req'
export const useCartStore = defineStore('cart', () => {
  let cartList: any = ref([])
  const loadCartList = () => {
    req.get('http://localhost:3000/cartList').then((res: any) => {
      console.log(res)
      cartList.value = res.data
    })
  }
  loadCartList()
  function setCartList(list: any) {
    // console.log('store中的修改方法调用')
    // console.log(showBottom)
    cartList.value = list
  }

  return { cartList, setCartList }
})
